FROM rust:latest as builder
WORKDIR /usr/src/rtcmd
COPY . .
COPY ./config.toml /usr/local/cargo/config.toml
RUN cargo install --path . 
FROM debian:bullseye-slim
RUN apt-get update && \
    apt-get install -y build-essential && \
    apt-get install -y libmagic-dev && \  
    rm -rf /var/lib/apt/lists/*
COPY --from=builder /usr/local/cargo/bin/rtcmd /usr/local/bin/rtcmd
CMD ["rtcmd"]
